clear;clc;
t = logspace(-10,10,100);
a = 100; p = 100; u0 = 4*pi*10^(-7); I = 1.0; A_R = a^2;
cgma = 1/p;
tao0 = t./(cgma*u0*a^2); 
[m,n] = size(tao0);
f=[];
for i = 1:n
    a = sqrt(1/tao0(i))*0.5;
    fai = yan_bfai(a,1000);
    f(i) = fai - exp(-1/(4*tao0(i))) * (1+6*pi) / (6*tao0(i) * sqrt(pi*tao0(i)));
end
M = (3*I*A_R)/(cgma*a^3);
eI = M.*f;
semilogx(tao0,f);
title("全区电动势图");

function [outputArg1] = yan_bfai(inputArg1,inputArg2)
%UNTITLED3 此处显示有关此函数的摘要
%   此处显示详细说明
a = inputArg1; b = inputArg2;
c = linspace(0,a,b); dx = c(2)-c(1); sum = 0;
for i = 1:b
    sum = sum + exp(-c(i)^2/2)*dx;
end
outputArg1 = sum*sqrt(2/pi);
end
